***************************
*HH DATA ANALYSIS**********
*Last edit September 29,2022 KB**
***************************

************
*APPENDICES*
************

************
*APPENDIX B*
************

***********************************************************
*INFORMATION EFFECTS ON RESPONDENT-POLITICIAN OBSERVATIONS*
***********************************************************

use "data/Uganda_HHsurvey_politicianlevelobs.dta", clear

*******************
*PRE-ANALYSIS PLAN*
*******************

sum satisfaction if project_info==0
reg satisfaction project_info i.strata, cluster(id)

sum vote if project_info==0
reg vote project_info i.strata, cluster(id)


************************
*LOOKING AT PERFORMANCE*
************************

sum satisfaction if bypass==0 & involvement==0
reg satisfaction bypass involvement bypassXinvolvement i.strata, cluster(id)


preserve

keep if prior_Japan!=1 & prior_imp_ip!=1

sum satisfaction if bypass==0 & involvement==0
reg satisfaction bypass involvement bypassXinvolvement i.strata, cluster(id)



**********************
*APPENDIX C, TABLE C1*
**********************

use "data/Uganda_HHsurvey_HHlevelobs.dta", clear

*Census Column comes from Uganda Bureau of Statistics (2016), The National Population and Housing Census 2014
*Study Sample Column*


tab ageyears if ageyears>19
tab a17_occupation if a17_occupation<11 | (a17_occupation==14 | a17_occupation==666)
tab a13_ethnicity
tab a18_religion

**********************
*APPENDIX C, TABLE C2*
**********************

use "data/Uganda_HHsurvey_politicianlevelobs.dta", clear

global DESCVARS smallscalefarmer largescalefarmer craftperson ageyears female completedS4 completedP7 NRM correctprior correctprior2 gonetoproject proj_quality heardproj heardorg NRM_politician
mata: mata clear

local count: word count $DESCVARS
mat sumstat = J(`count',8,.)

local i = 1
foreach var in $DESCVARS {
    quietly: summarize `var' if bypass==0 & donor==0 & imp==0 & vote!=.
    mat sumstat[`i',1] = r(mean)
    mat sumstat[`i',2] = r(sd)
    quietly: summarize `var' if donor==1 & vote!=.
    mat sumstat[`i',3] = r(mean)
    mat sumstat[`i',4] = r(sd)
    quietly: summarize `var' if imp==1 & vote!=.
    mat sumstat[`i',5] = r(mean)
    mat sumstat[`i',6] = r(sd)
    quietly: summarize `var' if bypass==1  & vote!=.
    mat sumstat[`i',7] = r(mean)
    mat sumstat[`i',8] = r(sd)
    local i = `i' + 1
}

frmttable, statmat(sumstat) store(sumstat) sfmt(g,f,g,f,g,f,g,f)


outreg using "balance_dem.doc", ///
    replay(sumstat) nocenter note("") plain replace ///
    ctitles( "", Control, "", Traditional Aid, "",  Outsourcing, "", Bypass Aid, "" \ "", mean, sd, mean, sd, mean, sd, mean, sd) ///
	multicol(1,2,2;1,4,2; 1,6,2; 1,8,2) 

******************

global DESCVARS smallscalefarmer largescalefarmer craftperson ageyears female completedS4 completedP7 NRM correctprior correctprior2 gonetoproject proj_quality heardproj heardorg NRM_politician
mata: mata clear
	
local count: word count $DESCVARS
mat sumstat = J(`count',6,.)

local i = 1
foreach var in $DESCVARS {
    quietly: summarize `var' if involvement==0 & vote!=.
    mat sumstat[`i',1] = r(mean)
    mat sumstat[`i',2] = r(sd)
    quietly: summarize `var' if involvement==1 & vote!=.
    mat sumstat[`i',3] = r(mean)
    mat sumstat[`i',4] = r(sd)
    quietly: summarize `var' if involvement==2 & vote!=.
    mat sumstat[`i',5] = r(mean)
    mat sumstat[`i',6] = r(sd)
    local i = `i' + 1
}

frmttable, statmat(sumstat) store(sumstat) sfmt(g,f,g,f,g,f)


outreg using "balance_dem_capacity.doc", ///
    replay(sumstat) nocenter note("") plain replace ///
    ctitles( "", Weak Oversight, "", Intermediate Oversight, "",  High Oversight, "" \ "", mean, sd, mean, sd, mean, sd) ///
	multicol(1,2,2;1,4,2; 1,6,2) 
	
	

*************
*APPENDIX D**
**************************
*DROPPING DELAYED CONTROL*
**************************

reg vote bypass involvement bypassXinvolvement i.strata if sgroup!=1, cluster(id)


*************
*APPENDIX E**
******************************************************
*EFFECTS ON PROJECT QUALITY AND GOVERNMENT CORRUPTION*
*NOTE: These outcomes vary by respondent, not by respondent-political office*
*****************************************************************************

use "data/Uganda_HHsurvey_HHlevelobs.dta", clear

gen Southern = 0 if Northern==1
replace Southern = 1 if Northern==0

gen donorXSouth = donor*Southern
gen impXSouth = imp*Southern
gen bypassXSouth =bypass*Southern

reg proj_qual bypass bypassXSouth Southern i.strata, robust
reg corruption bypass bypassXSouth Southern i.strata, robust


	
************
*APPENDIX F*
*********************************************
**EFFECTS BY POLITICIAN'S ACTUAL INVOLVEMENT*
*********************************************

use "data/Uganda_HHsurvey_politicianlevelobs.dta", clear

gen bypassXactualinvolvement = bypass*pol_involvement
	
sum credit if bypass==0 & pol_involvement==0
reg credit bypass bypassXactualinvolvement pol_involvement i.strata, cluster(id)

sum othersvote if bypass==0 & pol_involvement==0
reg othersvote bypass bypassXactualinvolvement pol_involvement i.strata, cluster(id)

sum vote if bypass==0 & pol_involvement==0
reg vote bypass bypassXactualinvolvement pol_involvement i.strata, cluster(id)

		

************
*APPENDIX G*
**************************************************************************************************************************
*WHAT ARE THE EFFECTS BY COMPONENTS OF OVERSIGHT CAPACITY (DIVIDING BY GEOGRAPHIC AND OFFICE-SPECIFIC POLITICAL CAPACITY)*
**************************************************************************************************************************

reg credit bypass i.strata if poltype==2 & Northern==1, robust
reg credit bypass i.strata if poltype==2 & Northern==0, robust
reg credit bypass i.strata if poltype!=2 & Northern==1, robust
reg credit bypass i.strata if poltype!=2 & Northern==0, robust
reg othersvote bypass i.strata if poltype==2 & Northern==1, robust
reg othersvote bypass i.strata if poltype==2 & Northern==0, robust
reg othersvote bypass i.strata if poltype!=2 & Northern==1, robust
reg othersvote bypass i.strata if poltype!=2 & Northern==0, robust
reg vote bypass i.strata if poltype==2 & Northern==1, robust
reg vote bypass i.strata if poltype==2 & Northern==0, robust
reg vote bypass i.strata if poltype!=2 & Northern==1, robust
reg vote bypass i.strata if poltype!=2 & Northern==0, robust

************
*APPENDIX H*
************

*ALL TREATMENTS*
reg credit donor imp bypass i.strata, cluster(id)
reg othersvote donor imp bypass i.strata, cluster(id)
reg vote donor imp bypass i.strata, cluster(id)

*ALL TREATMENTS*
reg credit donor imp bypass involvement donorXinvolvement impXinvolvement bypassXinvolvement i.strata, cluster(id)
reg othersvote donor imp bypass involvement donorXinvolvement impXinvolvement bypassXinvolvement i.strata, cluster(id)
reg vote donor imp bypass involvement donorXinvolvement impXinvolvement bypassXinvolvement i.strata, cluster(id)


*************
*APPENDIX I**
*****************
*ANY INFORMATION*
*****************

gen anytreatment = 0 if donor!=.
replace anytreatment = 1 if donor==1 | imp == 1 | bypass ==1

gen anytreatmentXinvolvement = anytreatment*involvement

reg credit anytreatment involvement anytreatmentXinvolvement i.strata, cluster(id)
reg othersvote anytreatment involvement anytreatmentXinvolvement i.strata, cluster(id)
reg vote anytreatment involvement anytreatmentXinvolvement i.strata, cluster(id)



************
*APPENDIX J*
***************************************************************************	
*HETEROGENOUS EFFECTS ON BELIEFS ABOUT TYPE OF INVOLVEMENT*****************
*THIS DEMONSTRATES TYPES OF INFERENCES THAT HOUSEHOLDS MAKE ABOUT PROJECTS*
***************************************************************************

*Lobbied for project/Secured project financing*
sum act_1_
reg act_1_ bypass involvement bypassXinvolvement i.strata
**HAVE COMBINED approval and paperwork TO MAKE MORE EQUIVALENT TO IMP PARTNER CATEGORIES
sum paperwork
reg paperwork bypass involvement bypassXinvolvement i.strata
**Helped monitor or manage project**
sum act_4_
reg act_4_ bypass involvement bypassXinvolvement i.strata
**Community mobilization or sensitization**
sum act_5_
reg act_5_ bypass involvement bypassXinvolvement i.strata


************
*APPENDIX K*
************

*TABLE K1*

gen bypassXgoneproject =bypass*gonetoproject

reg credit  bypass bypassXgoneproject gonetoproject i.strata, cluster(id)
reg othersvote bypass bypassXgoneproject gonetoproject i.strata, cluster(id)
reg vote bypass bypassXgoneproject gonetoproject i.strata, cluster(id)

*TABLE K2*

gen NRMmatch = NRM_politician*NRM

gen bypassXNRMmatch =bypass*NRMmatch

reg credit bypass bypassXNRMmatch NRMmatch i.strata, cluster(id)
reg othersvote bypass bypassXNRMmatch NRMmatch i.strata, cluster(id)
reg vote bypass bypassXNRMmatch NRMmatch i.strata, cluster(id)

*TABLE K3*

gen bypassXNRMpol = bypass*NRM_politician

reg credit  bypass NRM_politician bypassXNRMpol i.strata, cluster(id)
reg othersvote  bypass NRM_politician bypassXNRMpol i.strata, cluster(id)
reg vote bypass NRM_politician bypassXNRMpol i.strata, cluster(id)

